package boogie;

import boogie.game.Game;
import java.awt.Color;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JFrame;

/**
 *
 * @author Boogie
 */
public class Main extends Game{

    public Main() {
        super(600 , 600);
    }    

    @Override
    public void initStates() {
        TestState testState = new TestState(this);
        TestState2 testState2 = new TestState2(this);
        
        this.setCurrentState(testState);

    }
    
    public static void main(String[] args) {
        JFrame f= new JFrame("Snake");
        
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       
        
        final Main g = new Main();
        f.add(g);
        f.setBackground(Color.BLACK);
        f.setVisible(true);
        f.setSize(610, 610);
        f.addKeyListener(new KeyListener() {

            @Override
            public void keyTyped(KeyEvent e) {
                
            }

            @Override
            public void keyPressed(KeyEvent e) {
                
            }

            @Override
            public void keyReleased(KeyEvent e) {
                if(e.getKeyCode()==KeyEvent.VK_1){
                    g.setCurrentState(g.getState("test"));
                    return;
                }
                if(e.getKeyCode()==KeyEvent.VK_2){
                    g.setCurrentState(g.getState("test2"));
                    return;
                }
                
            }
        });
        g.start();
        
    }

    

}
